-
Notifications
You must be signed in to change notification settings - Fork 675
Support parsing parenthesized wildcard (*)
#2123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support parsing parenthesized wildcard (*)
#2123
Conversation
tests/sqlparser_common.rs
Outdated
| } | ||
|
|
||
| #[test] | ||
| fn parse_select_distinct_parenthesized_wildcard() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fn parse_select_distinct_parenthesized_wildcard() { | |
| fn parse_select_parenthesized_wildcard() { |
thinking since the syntax isn't implemented solely on the distinct keyword?
src/parser/mod.rs
Outdated
| self.next_token(); // consume RParen | ||
| return Ok(Expr::Wildcard(AttachedToken(inner_token))); | ||
| } | ||
| // Not a (*), reset and fall through to parse_expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks incorrect per the comment, by reset should we have called prev_token() or similar to undo the consumed inner token *?
src/parser/mod.rs
Outdated
| let inner_token = self.next_token(); | ||
| if inner_token.token == Token::Mul && self.peek_token().token == Token::RParen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be simplified by calling self.peek_tokens_ref(Token::MUL, Token::RParen)?
|
@iffyio Updated. Thank you for reviewing |
| // Not a (*), fall through to reset index and call parse_expr | ||
| self.prev_token(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling self.prev_token() doesn't seem needed? similar to the _ branch, the fall-through paths call self.index = index; to reset at the end it looks like
Support parsing parenthesized wildcard
(*)Example of query: